1145 HOME : PRINT "PLAY GOES LIKE THIS---": PRINT : PRINT " 1. YOU MAKE A GUESS AS TO WHAT YOU": PRINT " THINK THE SECRET NUMBER IS.": PRINT : PRINT " 2. YOUR APPLE EVALUATES YOUR GUESS": PRINT " AND RESPONDS WITH AN INDICATION"
1150 PRINT " OF HOW GOOD YOUR GUESS WAS.": PRINT : PRINT " 3. YOU RECORD YOUR GUESS AND THE": PRINT " RESPONSE TO IT.": PRINT : PRINT " 4. THEN YOU FORMULATE ANOTHER GUESS": PRINT " BASED ON PREVIOUS GUESSES AND"
1152 PRINT " RESPONSES."
1155 PRINT : PRINT " 5. THE FIRST PERSON TO GUESS THE": PRINT " APPLE'S SECRET NUMBER WINS.": PRINT : PRINT
1160 HTAB (12): INPUT "** HIT RETURN **";R$
1165 HOME : PRINT "THIS IS HOW THE APPLE EVALUATES YOUR": PRINT "GUESS---": PRINT : PRINT " 1. FOR EACH DIGIT THAT YOU HAVE IN THE": PRINT " CORRECT POSITION YOU ARE AWARDED": PRINT " ONE 'BULL'.
1170 PRINT : PRINT " 2. FOR A DIGIT THAT IS IN THE SECRET": PRINT " NUMBER BUT NOT IN THE CORRECT": PRINT " POSITION YOU ARE AWARDED ONE 'COW'."
1175 PRINT : PRINT " 3. DIGITS THAT DO NOT APPEAR IN THE": PRINT " NUMBER AT ALL GENERATE NO RESPONSE."
1180 VTAB (22): HTAB (12): INPUT "** HIT RETURN **";R$
1185 HOME : PRINT "ASSUME THE SECRET NUMBER IS:": PRINT : HTAB (13): PRINT "7032": PRINT : PRINT "THEN THESE ARE EXAMPLES OF GUESSES AND": PRINT "RESPONSES.": PRINT
1195 VTAB (22): HTAB (12): INPUT "** HIT RETURN **";R$
1200 HOME : PRINT " --- HINT ---": PRINT : PRINT "MAKE YOUR FIRST TWO GUESSES": PRINT : PRINT " 1234 AND 5678": PRINT
1205 PRINT "THEN IF YOU HAVE FOUR RESPONSES FROM": PRINT "YOUR FIRST TWO GUESSES,": PRINT " YOU WILL KNOW 9 & 0 ARE NOT IN": PRINT " THE SECRET NUMBER."
1210 PRINT : PRINT "IF YOU HAVE TWO RESPONSES FROM YOUR": PRINT "FIRST TWO GUESSES,": PRINT " YOU WILL KNOW 9 & 0 ARE IN THE": PRINT " SECRET NUMBER."
1215 PRINT : PRINT "WHAT DO YOU KNOW IF YOU HAVE THREE": PRINT "RESPONSES FROM YOUR FIRST TWO GUESSES?": PRINT
1220 PRINT " ... GOOD LUCK ...": VTAB (22): HTAB (12): INPUT "** HIT RETURN **";R$
1990 RETURN
2000 REM ------------------------- GET.PLAYER'S.NAMES -------------------------
2010 NP = 0
2020 HOME : VTAB (12)
2030 NP = NP +1
2040 PRINT "ENTER THE NAME OF PLAYER # ";NP
2050 PRINT : INPUT " ";PN$(NP)
2060 HOME : VTAB (12)
2070 INPUT "ANY MORE PLAYER'S? (Y OR N) ";R$
2075 HOME
2080 IF R$ = "Y" GOTO 2020
2090 RETURN
3000 REM ------------------------- PLAY.A.GAME -------------------------
3020 GOSUB 4000
3021 REM GENERATE.SECRET.NUMBER
3030 GOSUB 5000
3031 REM PRESENT.A.TURN
3040 IF WN$ = "N" GOTO 3030
3041 REM NO WIN????
3050 IF TN < >NP GOTO 3030
3060 RETURN
4000 REM ------------------------- GENERATE.SECRET.NUMBER -------------------------
4020 I = 0
4030 I = I +1
4040 IF I >4 GOTO 4110
4050 SN(I) = INT( RND(1) *10)
4060 J = 0
4070 J = J +1
4080 IF J = I GOTO 4030
4090 IF SN(I) = SN(J) GOTO 4050
4100 GOTO 4070
4110 WN$ = "N"
4111 REM WN$ = WIN SWITCH
4120 RETURN
5000 REM ------------------------- PRESENT.A.TURN -------------------------
5020 TN = TN +1
5030 IF TN >NP THEN TN = 1
5040 HOME : VTAB (12)
5050 PRINT "IT IS ";PN$(TN);"'S TURN"
5060 VTAB (16)
5070 PRINT "OTHER PLAYERS DON'T LOOK"
5080 VTAB (20)
5090 PRINT "HIT RETURN, ";PN$(TN);
5100 INPUT " ";R$
5110 GOSUB 6000
5111 REM GET.A.GUESS...
5120 GOSUB 7000
5121 REM EVALUATE GUESS...
5130 GOSUB 8000
5131 REM DISPLAY.GUESS.RESULT
5140 RETURN
6000 REM ------------------------- GET.A.GUESS -------------------------
6020 HOME : VTAB (8)
6030 HTAB (10): PRINT "OK, ";PN$(TN)
6040 VTAB (12): PRINT "ENTER YOUR GUESS, 4 DIGITS, NO REPEATS"
6050 VTAB (17): HTAB (17): PRINT "----"
6055 VTAB (16): HTAB (16)
6060 INPUT " ";GS$
6070 IF LEN(GS$) < >4 GOTO 6180
6080 IF VAL(GS$) <123 OR VAL(GS$) >9876 GOTO 6180
6090 I = 0
6100 I = I +1
6110 IF I >4 GOTO 6300
6120 GS(I) = VAL( MID$ (GS$,I,1))
6130 J = 0
6140 J = J +1
6150 IF J = I GOTO 6100
6160 IF GS(I) = GS(J) GOTO 6180
6170 GOTO 6140
6180 VTAB (16)
6190 CALL -868
6200 HTAB (15)
6210 FLASH
6220 PRINT "TRY AGAIN"
6230 NORMAL
6240 FOR I = 1 TO 2000: NEXT
6250 VTAB (16): CALL -868
6260 GOTO 6050
6300 RETURN
7000 REM ------------------------- EVALUATE.GUESS -------------------------
7020 BU = 0:CO = 0
7030 FOR I = 1 TO 4
7040 FOR J = 1 TO 4
7050 IF I = J AND GS(J) = SN(I) THEN BU = BU +1
7060 IF I < >J AND GS(J) = SN(I) THEN CO = CO +1
7070 NEXT J
7080 NEXT I
7090 RETURN
8000 REM ------------------------- DISPLAY.GUESS.RESULT -------------------------
8010 HOME : VTAB (3): HTAB (18): PRINT PN$(TN)
8025 VTAB (6): HTAB (15)
8027 PRINT "GUESS = ";GS$
8030 VTAB (8): HTAB (17)
8040 PRINT CO;" COW";: IF CO < >1 THEN PRINT "S";
8045 PRINT
8050 VTAB (10): HTAB (17)
8060 PRINT BU;" BULL";: IF BU < >1 THEN PRINT "S";
8065 PRINT
8068 IF BU = 4 GOTO 8200
8069 IF WN$ = "Y" GOTO 8255
8070 VTAB (14): HTAB (4): PRINT "RECORD YOUR GUESS AND RESULT"
8080 VTAB (18): HTAB (8): INPUT "** THEN HIT RETURN **";R$
8090 GOTO 8500
8200 VTAB (14): HTAB (16): FLASH
8205 WN$ = "Y"
8210 PRINT "THAT'S IT": NORMAL
8220 IF TN = NP GOTO 8270
8230 VTAB (16): PRINT " LET THE OTHERS FINISH THEIR TURN"
8240 VTAB (18): HTAB (12): INPUT "** HIT RETURN **";R$
8250 GOTO 8500
8255 IF TN < >NP GOTO 8070
8260 VTAB (14): HTAB (11): PRINT "THERE WAS A WINNER"
8270 VTAB (18): INPUT "WANT TO PLAY ANOTHER GAME? (Y OR N) ";AG$